Data Frame Game

by: IanUK, 7 years ago

Last edited: 7 years ago

Hey there Harrison,   I've been watching your Vids for the last week and really love what your doing,  like a lot of people, I guess, I'm coming over from Excel VBA to Python Data for the machine learning and Pandas,  I can see some great benefits in what I do.

I have a dataset that is depth based and I need to populate up the data to match the actual sample size (for when I get to adding image clustering ) .  the images are getting me data on 0.01mm  while my measured  dataset is on samples that are about 40mm. To scale the measured data from a point im using

<pre class='prettyprint lang-py'>
x=0
    for i in df['Depth']:
        x=+1
        measured_data = df.iloc[x, :]
        for y in range(size):
            added_p = i+y
            added_n = i-y
            measured_data["Depth"] = added_p
            df.append(measured_data)
            measured_data["Depth"] = added_n
            df.append(measured_data)
</pre>  

I get the feeling I'm missing the point with Dataframes and falling back on my VBA habits

the dataset I'm testing this on is about 5,000 rows and the size variable is set at 200 (ie 200 x .1mm each way for 40mm total.

it is taking a reasonable amount of time.  hoping there is a brain out there that can see though my fumbling code




You must be logged in to post. Please login or register an account.



PS  I have been giving it a try by setting the "Depth" as and index but I'm having trouble returning what I need.

I have also changed the adding line to
df.loc(len(df)) = measured_data  the first version was doing a lot of work but no result!!

-IanUK 7 years ago
Last edited 7 years ago

You must be logged in to post. Please login or register an account.